<include file="public@meta" />

<body>
<div class="layui-fluid">
    <div class="layui-card-body layui-row">
        <form method="post" class="layui-form layui-col-md8 layui-col-lg6" action="{:url('add')}">
            <div class="layui-form-item">
                <label class="layui-form-label">父级名称</label>
                <div class="layui-input-inline">
                    <select name="pid" lay-filter="menu" class="layui-select">
                        <option value="0">--默认顶级--</option>
                        <foreach name="admin_menu_level_list" item="vo">
                            <option <if condition="$pid eq $vo['id']"> selected="selected" </if> value="{$vo.id}">{$vo.str}{$vo.title}
                            </option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单名称<span class="form-required">*</span></label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="title" lay-verify="required" lay-verType="tips"
                           placeholder="请输入菜单名称">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">URL</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="name"
                           placeholder="模块名/控制器/方法 如：admin/Index/index">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="input-status" class="layui-form-label">是否显示</label>
                <div class="layui-input-inline">
                    <input type="radio" name="status" value="1" title="启用" checked="checked">
                    <input type="radio" name="status" value="0" title="禁用">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-inline">
                    <input type="number" name="sort" value="0" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="layui-btn-form-submit" id="layui-btn-form-submit" value="确认添加">
                <input type="button" lay-submit lay-filter="layui-btn-form-edit" id="layui-btn-form-edit" value="确认编辑">
            </div>
        </form>
    </div>
</div>

<script>
    layui.config({
        base: '__STATIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        layCenter: 'lib/layCenter', //主入口模块
    }).use(['index', 'form','layCenter','common'], function(){
        var $ = layui.$,
            form = layui.form,
            layCenter = layui.layCenter,
            common = layui.common;
        //监听提交
        form.on('submit(layui-btn-form-submit)', function(data){
            layCenter.FormSubmit("{:url('add')}",data.field,true);
        });

    });
</script>
</body>
</html>